package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.AccessoryItemMapper;
import com.ruoyi.system.domain.AccessoryItem;
import com.ruoyi.system.service.IAccessoryItemService;

/**
 * 配品 Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-24
 */
@Service
public class AccessoryItemServiceImpl implements IAccessoryItemService
{
    @Autowired
    private AccessoryItemMapper accessoryItemMapper;

    /**
     * 通过id查询配品
     *
     * @param id 配品主键
     * @return 配品
     */
    @Override
    public AccessoryItem selectAccessoryItemById(Long id)
    {
        return accessoryItemMapper.selectAccessoryItemById(id);
    }

    /**
     * 查询配品列表
     *
     * @param accessoryItem 配品
     * @return 配品
     */
    @Override
    public List<AccessoryItem> selectAccessoryItemList(AccessoryItem accessoryItem)
    {
        return accessoryItemMapper.selectAccessoryItemList(accessoryItem);
    }

    /**
     * 新增配品
     *
     * @param accessoryItem 配品
     * @return 结果
     */
    @Override
    public int insertAccessoryItem(AccessoryItem accessoryItem)
    {
        return accessoryItemMapper.insertAccessoryItem(accessoryItem);
    }

    /**
     * 修改配品
     *
     * @param accessoryItem 配品
     * @return 结果
     */
    @Override
    public int updateAccessoryItem(AccessoryItem accessoryItem)
    {
        accessoryItem.setUpdateTime(DateUtils.getNowDate());
        return accessoryItemMapper.updateAccessoryItem(accessoryItem);
    }

    /**
     * 通过id批量删除配品信息
     *
     * @param ids 需要删除的配品主键
     * @return 结果
     */
    @Override
    public int deleteAccessoryItemByIds(Long[] ids)
    {
        return accessoryItemMapper.deleteAccessoryItemByIds(ids);
    }

    /**
     * 通过id删除配品信息
     *
     * @param id 配品主键
     * @return 结果
     */
    @Override
    public int deleteAccessoryItemById(Long id)
    {
        return accessoryItemMapper.deleteAccessoryItemById(id);
    }
}
